<?php
/**
 * Description of Valuelist
\* www.teuker.nl - mail@teuker.nl
 * 
 * @author francisc
 */

class Valuelist {

    public static function getRestaurantsChoices($filters = array()) {
        $valuelist = self::decorate();
        
        $data = SqlEngine::getUserRestaurants($filters);
        foreach ($data as $key => $value)
            $valuelist[$value['restaurant_id']] = $value['name'];

        return $valuelist;
    }

    public static function getTemplateChoices() {
        $valuelist = self::decorate();

        $data = SqlEngine::getTemplates();
        if (!empty($date)) {
            foreach ($data as $key => $value)
                $valuelist[$value['template_id']] = $value['name'];
        }

        return $valuelist;
    }

    public static function getTemplateTypeChoices() {
        $valuelist = self::decorate();

        $data = SqlEngine::getTemplateTypes();
        if (!empty($date)) {
            foreach ($data as $key => $value)
                $valuelist[$value['template_type_id']] = $value['name'];
        }

        return $valuelist;
    }

    public static function getGenderChoises() {
        Util::loadI18NHelper();
        return array(0 => __('Mr.'), 1 => 'Ms.');
    }

    public static function getMenuChoices() {
        $restaurant_id = sfContext::getInstance()->getUser()->getAttribute('current_restaurant_id');
        $menu_list = SqlEngine::getMenus(array('restaurant_id' => $restaurant_id));

        $menu_choices = array();
        foreach ($menu_list as $menu) {
            $menu_choices[$menu['menu_id']] = $menu['name'];
        }

        return $menu_choices;
    }

    public static function getTimeHourChoices() {
        return array('08' => '08', '09' => '09',
                     '10' => '10', '11' => '11',
                     '12' => '12', '13' => '13',
                     '14' => '14', '15' => '15',
                     '16' => '16', '17' => '17',
                     '18' => '18', '19' => '19',
                     '20' => '20', '21' => '21',
                     '22' => '22', '23' => '23');
    }

    public static function getTimeMinuteChoices() {
        return array('00' => '00', '15' => '15',
                     '30' => '30', '45' => '45');
    }

    public static function decorate($data = array()) {
        Util::loadI18NHelper();

        $valuelist = array();

        $valuelist[''] = __('Choose...');

        return $valuelist;
    }
}
